home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / tcoop10a.zip / DOC.ZIP / LIST.DOC < prev    next >
Text File  |  1991-11-20  |  4KB  |  115 lines

  1. LIST.DOC        11/10/91        Copyright (c) 1991 by James S. Clark
  2. ==========================================================================
  3. LIST
  4. List Class
  5. --------------------------------------------------------------------------
  6. Class Name                      List
  7. Superclass                      <none>
  8. Category                        List
  9. Other classes referenced        Node
  10. Other catagories referenced     <none>
  11. Used by                         many
  12. Inherited by                    many
  13.  
  14. Declaration                     List    *list = new List;
  15. Instance Variables
  16.                                 Node    *first;
  17.                                 Node    *last;
  18. Instance Methods
  19.                                 List    (int (*compare)
  20.                                         (void *node1, void *node2) = NULL);
  21.                                 virtual ~List   (void);
  22.                                 Node    *add    (Node *node);
  23.                                 Node    *add    (Node *before, Node *node);
  24.                                 Node    *after  (Node *node);
  25.                                 Node    *before (Node *node);
  26.                                 List    *copy   (int start, int end);
  27.                                 int     count   (void);
  28.                                 void    destroy (void);
  29.                                 Node    *get    (int index);
  30.                                 int     includes(Node *node)
  31.                                 Node    *remove (Node *node);
  32.                                 void    sort    (void);
  33.                                 List&   operator + (Node *node);
  34.                                 List&   operator - (Node *node);
  35. --------------------------------------------------------------------------
  36. GENERAL DESCRIPTION
  37.  
  38. The List Class provides the methods for manipulating single and double-
  39. linked lists.  It methods perform a number of actions commonly needed
  40. for list management.  It uses two variables, first and last, that point
  41. to the head and tail of the List.
  42.  
  43. Specialized list classes may be derived from the List Class to create
  44. lists that function in different ways.
  45.  
  46. --------------------------------------------------------------------------
  47. VARIABLES
  48.  
  49. Node    *first;
  50.         first points to the first Node in a List.
  51.  
  52. Node    *last;
  53.         last points to the last node in a List.
  54.  
  55. int     (*comparefunc)(void *node1, void *node2);
  56.         comparefunc points to a function that is used to test nodes
  57.         for insertion and sorting.
  58.  
  59. --------------------------------------------------------------------------
  60. METHODS
  61.  
  62. List    (int (*compare)(void *node1, void *node2) = NULL);
  63.         Constructor creates a new instance of the List Class with both
  64.         pointers set to NULL.
  65.  
  66. virtual ~List   (void);
  67.         Destructor deletes the List point.
  68.  
  69. Node    *add    (Node *node);
  70.         Adds a Node to the end of the List.
  71.  
  72. Node    *add    (Node *before, Node *node);
  73.         Inserts a Node in front of the Node matching the before Node.
  74.  
  75. Node    *after  (Node *node);
  76.         Return a pointer to the next Node in the List.
  77.  
  78. Node    *before (Node *node);
  79.         Returns a pointer to the previous Node in the List.
  80.  
  81. List    *copy   (int start, int end);
  82.         Returns a List containing the range of Nodes between the start
  83.         and end values. (not implemented as of 11/10/91)
  84.  
  85. int     count   (void);
  86.         Returns the number of Nodes in a List.
  87.  
  88. void    destroy (void);
  89.         Deletes the Nodes in a List but does not deallocate the List.
  90.         Use the destructor for that.
  91.  
  92. Node    *get    (int index);
  93.         Returns a pointer to the node in a list by index number.
  94.  
  95. int     includes(Node *node);
  96.         Test to see if Node is included in a List.
  97.  
  98. Node    *remove (Node *node);
  99.         Removes a Node from a List.
  100.  
  101. void    sort    (void);
  102.         Sorts the List using the compare function passed at the time
  103.         of the Lists creation.
  104.  
  105. List&   operator + (Node *node);
  106.         An operator that uses add to append a Node to the end of a List.
  107.  
  108. List&   operator - (Node *node);
  109.         An operator that uses remove to delete a Node from a list.
  110.  
  111. --------------------------------------------------------------------------
  112. LIST.DOC                        Copyright (c) 1991 by James S. Clark
  113. ==========================================================================
  114.  
  115.